@extends('layouts.master')

@section('content')
     <section id="content" class="col-lg-10 col-lg-push-1">
       <div id="signinbox"> 
       @if($errors->all())
     <div class="alert alert-danger">  
     <ul>
      @foreach($errors->all() as $error)
         <li>{{ $error }}</li>
      @endforeach
   </ul>
   </div>
   @endif

    @if(Session::has('flash_error'))
          <div class="alert alert-danger">
        <p>{{Session::get('flash_error')}}</p>
        </div>  
       @endif
   
 <div class="text-center "> 
<strong><h1>Edit profile</h1></strong>
<hr>
 </div> 
  
  {{ Form::open(array('url'=>'postEditprofile','method' => 'post',"role"=>"form","class"=>"form-horizontal col-lg-8")) }}
  <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('Username', 'Username')}}</label>
     <div class="col-lg-9">
      <p class="form-control-static">{{ Form::text('username', $user->username, array('class'=>'form-control col-lg-6', 'placeholder'=>' User Name')) }}</p>
    </div>
  </div>

 <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('email', 'Email Address')}} </label>
     <div class="col-lg-9">
      <p class="form-control-static"> {{ Form::text('email', $user->email, array('class'=>'form-control col-lg-3', 'placeholder'=>' Email address')) }}</p>
    </div>
  </div>

 <div class="form-group">
    <label class="col-lg-3 control-label">  {{ Form::label('firstname', 'First Name')}}  </label>
     <div class="col-lg-9">
      <p class="form-control-static">{{ Form::text('firstname', $profile->first_name, array('class'=>'form-control col-lg-6', 'placeholder'=>'Frist Name')) }}</p>
    </div>
  </div>

 <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('lastname', 'last Name')}}  </label>
     <div class="col-lg-9">
      <p class="form-control-static"> {{ Form::text('lastname', $profile->last_name, array('class'=>'form-control col-lg-6', 'placeholder'=>'Last Name')) }}</p>
    </div>
  </div>

<div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('address1', 'Address 1')}}  </label>
     <div class="col-lg-9">
      <p class="form-control-static">  {{ Form::text('addr1', $profile->addres1, array('class'=>'form-control col-lg-6', 'placeholder'=>'Address1')) }}</p>
    </div>
  </div>

  <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('address1', 'Address 2')}}  </label>
     <div class="col-lg-9">
      <p class="form-control-static"> {{ Form::text('addr2', $profile->addres2, array('class'=>'form-control col-lg-6', 'placeholder'=>'Address2')) }}</p>
    </div>
  </div>

  <div class="form-group">
    <label class="col-lg-3 control-label">  {{ Form::label('city', 'city')}}   </label>
     <div class="col-lg-9">
      <p class="form-control-static"> {{ Form::text('city', $profile->city, array('class'=>'form-control col-lg-6', 'placeholder'=>'Country')) }}</p>
    </div>
  </div>

  <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('province', 'Province')}} </label>
     <div class="col-lg-9">
      <p class="form-control-static"> {{ Form::text('Province', $profile->province, array('class'=>'form-control col-lg-6', 'placeholder'=>'Province')) }}</p>
    </div>
  </div>

  <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('country', 'Country')}}</label>
     <div class="col-lg-9">
      <p class="form-control-static"> {{ Form::text('country', $profile->country, array('class'=>'form-control col-lg-6', 'placeholder'=>'City')) }}</p>
    </div>
  </div>

 <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('network', 'Network')}}  </label>
     <div class="col-lg-9">
      <p class="form-control-static"> {{ Form::select('network', $networknames,$profile->network_id,array('class'=>'form-control col-lg-6')); }}</p>
    </div>
  </div>


@if($profile->company_id != 0 )

 <div class="form-group">
    <label class="col-lg-3 control-label">{{ Form::label('company', 'Company')}} </label>
     <div class="col-lg-9">
      <p class="form-control-static">  {{ link_to('/company/'.$profile->company_id, $companyname) }} </p>
    </div>
  </div>

@else
 <div class="form-group">
    <label class="col-lg-3 control-label"> {{ Form::label('company', 'Company')}}  </label>
     <div class="col-lg-9">
      <p class="form-control-static">  you dont have a company  {{ link_to('/company/create', 'create') }} one</p>
    </div>
  </div>

@endif

  @if($profile->user_id ==Auth::user()->id)

    <div class="form-group">
    <label class="col-lg-3 control-label"></label>
     <div class="col-lg-9">
      <p class="form-control-static">   {{ Form::submit('edit profile', array('class'=>'submit btn btn-primary flex-table-btn js-submit')) }}</p>
    </div>
  </div>

    @endif
 {{ Form::close() }}

    </div>
    <br><br><br>
     <br><br><br><br><br><br><br><br><br><br>
    </section>
@stop